#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

class node
{
    public:
        int* leftson;
        int* rightson;
        int* father;
        int num;
};

int main()
{
    int n;
    cin>>n;
    vector<int>xian(n);
    vector<int>zhong(n);
    vector<int>hou(n);
    for (int i=0;i<n;i++)
        cin>>hou[i];
    for (int i=0;i<n;i++)
        cin>>zhong[i];
    int* firstnode=&hou[n-1];
    vector<node>shu(n);
    
}